package com.dearbinge.data.service.impl.commodity;

import com.dearbinge.data.api.commodity.BrandService;
import com.dearbinge.data.dao.commodity.CommodityBrandInfoMapper;
import com.dearbinge.data.pojo.commodity.CommodityBrandInfoDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 品牌业务实现层
 *
 * @author wes
 * @date 2019/3/8
 */
@Service(value = "brandService")
public class BrandServiceImpl implements BrandService {

    @Autowired
    private CommodityBrandInfoMapper commodityBrandInfoMapper;

    /**
     * 根据id查询
     *
     * @param id id
     * @return 结果
     */
    @Override
    public CommodityBrandInfoDO getById(Integer id) {
        return commodityBrandInfoMapper.getById(id);
    }

    /**
     * 插入
     *
     * @param brand 品牌信息
     * @return 结果
     */
    @Override
    public Integer insert(CommodityBrandInfoDO brand) {
        return commodityBrandInfoMapper.insert(brand);
    }

    /**
     * 更新
     *
     * @param brand 品牌信息
     * @return 结果
     */
    @Override
    public Integer update(CommodityBrandInfoDO brand) {
        return commodityBrandInfoMapper.update(brand);
    }


    /**
     * 根据id删除
     *
     * @param id id
     * @return 结果
     */
    @Override
    public Integer delete(Integer id) {
        return commodityBrandInfoMapper.deleteById(id);
    }
}
